package org.lemon.cla.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.lemon.cla.enums.BookStatusEnum; // 导入图书状态枚举

import java.time.LocalDate; // 用于出版日期，通常只需要日期
import java.time.LocalDateTime; // 如果需要创建时间或更新时间

@Data
@TableName("book")
@Schema(description = "图书实体")
public class Book {

    @TableId(value = "book_id", type = IdType.AUTO)
    @Schema(description = "图书ID", example = "1")
    private Long bookId;

    @Schema(description = "ISBN (图书国标标号)", example = "978-7-121-12345-6")
    private String isbn;

    @Schema(description = "书名", example = "Spring Boot 实战")
    private String title;

    @TableField("cover_url")
    @Schema(description = "封面URL", example = "http://example.com/book_cover.jpg")
    private String coverUrl;

    @Schema(description = "作者", example = "张三")
    private String author;

    @Schema(description = "出版社", example = "人民邮电出版社")
    private String publisher;

    @TableField("publish_date")
    @Schema(description = "出版日期", example = "2023-01-01")
    private LocalDate publishDate; // 使用 LocalDate 映射数据库的 DATE 类型

    @TableField("total_copies")
    @Schema(description = "库存数量", example = "100")
    private Integer totalCopies;

    @TableField("available_copies")
    @Schema(description = "剩余数量", example = "85")
    private Integer availableCopies;

    @Schema(description = "存放位置", example = "A区3层2排")
    private String location;

    @Schema(description = "图书状态", example = "可借", allowableValues = {"可借", "已借", "预约中", "维护中"})
    private BookStatusEnum status; // 直接使用枚举类型
}